////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                           BailterRay                                       //
//                    Pip Robbins & Zhao Zhang                                //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
class BailterRayLoadBonusLevelTrigger extends PhysicsVolume
    placeable;

var SoundCue errorSpeech;

event ActorEnteredVolume(Actor Other)
{
	if (!Other.bStatic)
	{
		LoadLevel(Other);
	}
}

event PawnEnteredVolume(Pawn Other)
{
	LoadLevel(Other);
}

simulated event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
{
	if (!Other.bStatic)
	{
		LoadLevel(Other);
	}
}

simulated event LoadLevel(Actor Other)
{

    local BailterRayPawn P;
    local BailterRayPlayerController PC;
    local string GameExec;

	P = BailterRayPawn(Other);
	if(!P.IsHumanControlled())
	{
		return;
	}
	PC = BailterRayPlayerController(P.Controller);

	if(PC.CurrentSamples == 13)
	{
	   GameExec = "open BR-BailterRayBonusPlanet_01?game=BailterRay.BailterRay?MaxPlayers=1?MinNetPlayers=0?NumPublicConnections=16?NumPrivateConnections=0?NumOpenPublicConnections=0?NumOpenPrivateConnections=0?bShouldAdvertise=True?bIsLanMatch=false?bUsesStats=True?bAllowJoinInProgress=True?bAllowInvites=True?bUsesPresence=True?bAllowJoinViaPresence=True?bUsesArbitration=false?bIsDedicated=false?bIsListPlay=false?OwningPlayerName=?GameMode=0?Difficulty=4?PureServer=1?LockedServer=0?Campaign=0?ForceRespawn=0?GoalScore=1?TimeLimit=0?ServerDescription=?NumPlay=1?name=AstroExplorer";
       ConsoleCommand(GameExec);
    } else {
       self.PlaySound(errorSpeech);
       PC.ShowInfo(0, 7, "You need to collect all of the samples to access this bonus level");
    }

}

defaultproperties
{
   Begin Object Name=BrushComponent0 ObjName=BrushComponent0 Archetype=BrushComponent'Engine.Default__PhysicsVolume:BrushComponent0'
      ObjectArchetype=BrushComponent'Engine.Default__PhysicsVolume:BrushComponent0'
   End Object
   BrushComponent=BrushComponent0
   Components(0)=BrushComponent0
   CollisionComponent=BrushComponent0
   CollisionType=COLLIDE_CustomDefault
   Name="Default__BailterRayLoadBonusLevelTriggerVolume"
   ObjectArchetype=PhysicsVolume'Engine.Default__PhysicsVolume'
   errorSpeech = SoundCue'BailterRaySoundPackages.PICKUPS.Pickup_ErrorCue'
}